home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
58189
/
58189.xpi
/
modules
/
Policy.jsm
< prev
next >
Wrap
Text File
|
2010-01-06
|
1KB
|
67 lines
/*
* This class contains general policy definitions and operations.
*/
var EXPORTED_SYMBOLS = [ ];
Components.utils.import("resource://csfiremodules/CsFireCommon.jsm");
CsFire.Policy = new function() {
this.DISABLED = 0;
this.ACCEPT = 1;
this.STRIP = 2
this.BLOCK = 3;
this.SRC_CLIENT = 0;
this.SRC_SERVER = 1;
}
/*
* This function converts the numerical decision representation to a textual value.
*/
CsFire.Policy.textualDecision = function(decision) {
var result = "";
if(decision.whitelist) {
result += "WHITELISTED";
}
else {
switch(decision.source) {
case this.SRC_CLIENT: result = "CLIENT - ";
break;
case this.SRC_SERVER: result = "SERVER - ";
break;
}
switch(decision.action) {
case this.ACCEPT: result += "ACCEPT";
break;
case this.STRIP: result += "STRIP";
if(decision.stripAuth != null && decision.stripAuth == true) {
result += " (AUTH)";
}
if(decision.stripCookies != null && decision.stripCookies == true) {
result += "(COOKIES"
if(decision.cookieExceptions != null) {
result += " [";
for(cookie in decision.cookieExceptions) {
result += cookie;
result += ";";
}
result += "]";
}
result += ")";
}
break;
case this.BLOCK: result += "BLOCK";
break;
case this.DISABLED: result += "DISABLED";
break;
}
}
return result;
}